package domain.tc;

/**
 * This is a class that simulates FRIENDS in C++, which allows concrete features
 * to deposit clashing concepts into the associated clash finder.
 * 
 * @see http://wiki.apidesign.org/wiki/APIDesignPatterns%3aFriendPackages
 * @author j55wu
 * 
 */
public abstract class InitGraphAccessor {

	private static volatile InitGraphAccessor def;

	public static InitGraphAccessor getDefault() {
		InitGraphAccessor a = def;
		if (a == null) {
			throw new IllegalStateException("Unknown init graph accessor " + a);
		}
		return a;
	}

	public static void setDefault(InitGraphAccessor accessor) {
		// if (def != null) {
		// throw new
		// IllegalStateException("Default graph: "+def.currentInitGraph());
		// }
		def = accessor;
	}

	public InitGraphAccessor() {
	}

	protected abstract InitDomainGraph currentInitGraph();

}
